<?php
   include('./library/conn.php');

   $username=$_REQUEST['username'];
   $email=$_REQUEST['email'];
  $phonenum=$_REQUEST['phonenum'];
  $password=$_REQUEST['password'];
   $sql = "select * from user where username = '$username' ";
   $sql2 = "select * from user where email = '$email' ";
   $sql3 = "select * from user where phonenum = $phonenum";

   $res = $conn->query($sql);
   $res2 = $conn->query($sql2);
   $res3 = $conn->query($sql3);

   if($res->num_rows>0){
      echo '该会员名已存在';
      die();
   }
   
   if($res2->num_rows>0){
      echo '该邮箱已存在';
      die();
   }

   if($res3->num_rows>0){
      echo '该手机号已存在';
      die();
   }

   $sql4="insert into `user`(phonenum,password, username, email) VALUES ('$phonenum','$password','$username','$email')";
   $res5 = $conn->query($sql4);
   $conn->close();
   echo '注册成功';
?>